package com.rays.sysmech.core;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;

public class DuplicateDataInfo 
{
	Hashtable<FileData, ArrayList<String>>  duplicateVsOriginal;
	
	long duplicateDataSize;
	
	public DuplicateDataInfo()
	{
		duplicateVsOriginal = new Hashtable<FileData, ArrayList<String>>();
		duplicateDataSize = 0;
	}
	
	public void addData(final FileData original, final FileData duplicate)
	{
		if(duplicateVsOriginal.containsKey(original))
		{
			ArrayList<String> locations = duplicateVsOriginal.get(original);
			locations.add(duplicate.getPath());
		}
		else
		{
			ArrayList<String> locations = new ArrayList<String>();
			locations.add(original.getPath());
			locations.add(duplicate.getPath());
			duplicateVsOriginal.put(original, locations);
		}
		
		duplicateDataSize += duplicate.getSize();
	}
	
	public int getNumberOfRecords()
	{
		return duplicateVsOriginal.size();
		
	}
	
	public long getTotalDuplicatedataSize()
	{
		return duplicateDataSize;
	}
	
	public Iterator<Entry<FileData, ArrayList<String>>>  getRecordIterator()
	{
		return duplicateVsOriginal.entrySet().iterator();
	}

}
